package org.example;

import org.yaml.snakeyaml.Yaml;
import java.io.InputStream;
import java.util.Map;

public class AppConfig {
    public static void main(String[] args) {
        Yaml yaml = new Yaml();
        try (InputStream input = AppConfig.class.getClassLoader().getResourceAsStream("config.yaml")) {
            Map<String, Object> config = yaml.load(input);
            Map<String, String> database = (Map<String, String>) config.get("database");
            /*获取url*/
            System.out.println("URL: " + database.get("url"));

            Map<String, String> db1 = (Map<String, String>) config.get("databases1");
            System.out.println(db1.get("url")) ;

        } catch (Exception e) {
            System.out.println("Exception: " + e);
        }
    }
}